<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>将字符串转化为小写</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.strtok.html">« strtok</a></li>
      <li style="float: right;"><a href="function.strtoupper.html">strtoupper »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.strings.html">字符串 函数</a></li>
    <li>将字符串转化为小写</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.strtolower" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strtolower</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strtolower</span> &mdash; <span class="dc-title">将字符串转化为小写</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.strtolower-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>strtolower</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
  将 <code class="parameter">string</code> 中所有的 ASCII 字母字符转换为小写并返回。
  </p>
  <p class="para">
   <code class="literal">&quot;A&quot;</code>（0x41）到 <code class="literal">&quot;Z&quot;</code>（0x5a）范围内的字节会通过将每个字节值加 32 转为相应的小写字母。
  </p>
  <p class="para">
   这可用于转换用 UTF-8 编码的字符串中的 ASCII 字符，但会忽略多字节 UTF-8 字符。要转换多字节非
   ASCII 字符，请使用 <span class="function"><a href="function.mb-strtolower.html" class="function">mb_strtolower()</a></span>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.strtolower-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">string</code></dt>

     <dd>

      <p class="para">
       输入字符串。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.strtolower-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回转换后的小写字符串。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.strtolower-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     
 <tr>
  <td>8.2.0</td>
  <td>
   大小写转换不在依赖于使用 <span class="function"><a href="function.setlocale.html" class="function">setlocale()</a></span> 设置的区域。只会转换 ASCII 字符。
  </td>
 </tr>


    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.strtolower-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4864">
    <p><strong>示例 #1 <span class="function"><strong>strtolower()</strong></span> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Mary&nbsp;Had&nbsp;A&nbsp;Little&nbsp;Lamb&nbsp;and&nbsp;She&nbsp;LOVED&nbsp;It&nbsp;So"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$str</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;打印&nbsp;mary&nbsp;had&nbsp;a&nbsp;little&nbsp;lamb&nbsp;and&nbsp;she&nbsp;loved&nbsp;it&nbsp;so<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>   
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.strtolower-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <span class="simpara">此函数可安全用于二进制对象。</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.strtolower-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.strtoupper.html" class="function" rel="rdfs-seeAlso">strtoupper()</a> - 将字符串转化为大写</span></li>
    <li class="member"><span class="function"><a href="function.ucfirst.html" class="function" rel="rdfs-seeAlso">ucfirst()</a> - 将字符串的首字母转换为大写</span></li>
    <li class="member"><span class="function"><a href="function.ucwords.html" class="function" rel="rdfs-seeAlso">ucwords()</a> - 将字符串中每个单词的首字母转换为大写</span></li>
    <li class="member"><span class="function"><a href="function.mb-strtolower.html" class="function" rel="rdfs-seeAlso">mb_strtolower()</a> - 使字符串小写</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>